import os

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "about_orm.settings")
import django

django.setup()

from app01 import models
ret = models.Person.objects.filter(pk__gt=1)  # greater than
ret = models.Person.objects.filter(pk__lt=5)  # less than
ret = models.Person.objects.filter(pk__gte=1)  # greater than equal
ret = models.Person.objects.filter(pk__lte=5)  # less than  equal

ret = models.Person.objects.filter(pk__range=[1,5])  # 范围

ret = models.Person.objects.filter(pk__in=[1,5,7,9])  # 范围

ret = models.Person.objects.filter(name__contains='alex')  # like
ret = models.Person.objects.filter(name__icontains='aLex')  # like ignore 忽略大小写

ret = models.Person.objects.filter(name__startswith='a')  # 以什么开头
ret = models.Person.objects.filter(name__istartswith='a')  # 以什么开头 gnore 忽略大小写

ret = models.Person.objects.filter(name__endswith='x')  # 以什么结尾
ret = models.Person.objects.filter(name__iendswith='a')  # 以什么结尾 gnore 忽略大小写


ret = models.Person.objects.filter(birth__year='2020')
ret = models.Person.objects.filter(birth__contains='2020-10')


ret = models.Person.objects.filter(age__isnull=False)


print(ret)
